/*
 *@Description: 用户模型
 *@Author: panlua
 *@Date: 2019-05-22 09:39:11
*/

const mongoose = require('mongoose')
const Schema = mongoose.Schema

const userSchema = new Schema({
  account: { // 账号
    type: String,
    required: true
  },
  password: { // 密码
    type: String,
    required: true
  },
  nickName: { // 昵称
    type: String,
    required: true
  },
  createTime: { // 创建时间
    type: Date,
    default: Date.now
  },
  updateTime: { // 更新时间
    type: Date,
    default: Date.now
  },
  email: String,
  age: Number,
  gender: Number, // 1：男  2：女 3：未知
}, {
  timestamps: {
    createdAt: 'createTime',
    updatedAt: 'updateTime'
  }
})

module.exports = mongoose.model('User', userSchema, 'user')